﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace InventoryManagementServer
{
    public static class XmlSerializer
    {
        public static string Serialize<T>(T obj)
        {
            var sw = new StringWriter();
            var serializer = new System.Xml.Serialization.XmlSerializer(typeof(T));
            serializer.Serialize(sw, obj);
            return sw.ToString();
        }

        public static T Deserialize<T>(string xml)
        {
            var sr = new StringReader(xml);
            var serializer = new System.Xml.Serialization.XmlSerializer(typeof(T));
            return (T)serializer.Deserialize(sr);
        }
    }
}